﻿using System;
using System.Collections;
using System.Data;
using CE.Database;

using System.Data.SqlClient;
using System.Data.Common;

namespace CE.CarInsurance
{
    public class FleetRequestDB
    {
        public FleetRequestDB()
        {
        }

        public Int64 Insert(FleetRequest fleetrequest)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocFleetRequestInsertUpdateSingleItem";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@RequestId", fleetrequest.RequestId);
            _sPara.Add("@CompanyName", fleetrequest.CompanyName);
            _sPara.Add("@WebSite", fleetrequest.WebSite);
            _sPara.Add("@Name", fleetrequest.Name);
            _sPara.Add("@Email", fleetrequest.Email);
            _sPara.Add("@Mobile", fleetrequest.Mobile);
            _sPara.Add("@CompanyContactNo", fleetrequest.CompanyContactNo);
            _sPara.Add("@NoOfCars", fleetrequest.NoOfCars);
            _sPara.Add("@CallAt", fleetrequest.CallAt);
            _sPara.Add("@IsExistCustomer", fleetrequest.IsExistCustomer);
            if (fleetrequest.AgentId == 0)
            {
                _sPara.Add("@AgentId", DBNull.Value);
            }
            else
            {
                _sPara.Add("@AgentId", fleetrequest.AgentId);
            }
            _sPara.Add("@IsAcceptTC", fleetrequest.IsAcceptTC);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

    }
}
